home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 19 / madtrb11.zip / MX80.PAS < prev    next >
Pascal/Delphi Source File  |  1985-08-05  |  5KB  |  126 lines

  1. Program MX80;
  2.  
  3. {
  4. Epson MX80 printer controller/ASCII file lister
  5.  
  6. Source: "MX80: Controlling the Epson/IBM Printer", TUG Lines Volume I Issue 3
  7. Author: Stan Dudek
  8. Application: All systems using Epson MX80 and compatibles
  9. }
  10.                 
  11.  
  12.    Var  Line_cnt,  i,  Page :  Integer;
  13.           Option :  String [1];
  14.         FileName :  String [15];
  15.             Temp :  String [255];
  16.           Source :  Text;
  17.  
  18. Procedure Menu;    {  Main Menu used in the program.  }
  19.   begin
  20.     writeln('Printer Utility with Text File Listing.              ver. 1.00');
  21.     for  i  := 1 to 10 DO
  22.       write('________') {  Draw a line on the screen.  };
  23.     write('                                       ');
  24.     writeln('[ This program will Abort on Errors ]');
  25.     writeln('   1 := Mode 132 Characters / Line.');           writeln;
  26.     writeln('   2 := Mode  80 Characters / Line.');           writeln;
  27.     writeln('   3 := Turn ON the Double Strike Mode.');       writeln;
  28.     writeln('   4 := Turn OFF the Double Strike Mode.');      writeln;
  29.     writeln('   5 := Type a message on the printer.');        writeln;
  30.     writeln('   6 := Print a Text File.   ');                 writeln;
  31.     writeln('   7 := To  EXIT  Program.       [ ]');
  32.     Page := 0;   { set the page number equal to zero   }
  33.   end;   { of Menu Procedure  }
  34.  
  35. Procedure Get_File;
  36.   begin
  37.      GotoXY (1,22);   { position the cursor under the menu. }
  38.      write('Enter the File name to list: ');
  39.      readln(FileName);
  40.      Assign(Source,FileName);
  41.      Reset(Source);
  42.   end;  {  of Get File Procedure   }
  43.  
  44. Procedure Read_Print;
  45.    Var Seed: integer;
  46.  
  47.    Procedure Title; { Prints the program name and page number on each page. }
  48.      begin
  49.        Page := Page + 1;   { increment the page number           }
  50.        write(Lst, char(27),char(71));    { Double Strike Mode ON }
  51.        write(Lst, 'Program Name:  ');
  52.        write(Lst, FileName);
  53.        write(Lst, '                                            Page ',Page);
  54.  
  55. { Warning:  The next writeln command will turn OFF the Double Strike mode.   }
  56. {           If you want Double Strike output, do not include the next line.  }
  57.  
  58.        writeln(Lst, char(27),char(72));  { Double Strike Mode OFF }
  59.  
  60.        writeln(Lst, '');       {  print a blank line              }
  61.        Line_cnt := 2;          {  set the line number to two      }
  62.      end;    {   of Title procedure   }
  63.  
  64. Procedure Page_Feed;
  65.   begin
  66.     for i := Line_cnt to 66 DO {  66 lines / page, Title will start at 2   }
  67.         writeln(Lst,'');
  68.     Title;   {  print the title on the new page  }
  69.   end;    { of Page Feed Procedure  }
  70.  
  71. begin
  72.   write('Enter the starting line of printer: ');
  73.   readln(Seed);
  74.   Title;     {  start page with the title                         }
  75.   Line_cnt := Seed;   {  set the line counter to the input value  }
  76.     repeat
  77.       readln(Source,Temp);      {  read one line of text from the file   }
  78.       writeln(Lst,Temp);        {  write one line of text to the printer }
  79.       write('.');               {  print a dot for every line printed    }
  80.       Line_cnt := Line_cnt + 1; {  increment the line counter            }
  81.       if Line_cnt > 59 then Page_Feed; {  test for end of page condition }
  82.     until EOF(Source);
  83.   close(Source);
  84. end;  { of Read Print Procedure }
  85.  
  86. Procedure Print_Msg; { write a one line message to the printer }
  87.      begin
  88.        GotoXY (1,22);       {  position the cursor      }
  89.        writeln('Enter message to Type on the Printer: ');
  90.        readln(Temp);
  91.        writeln(Lst,Temp);
  92.        ClrScr;              {  Clear the screen and . . .       }
  93.        Menu;                {          re-paint the menu.       }
  94.      end;    { of Print Msg Procedure }
  95.  
  96. Procedure List_It;  {  list a file to the printer  }
  97.      begin
  98.        Get_File;
  99.        Read_Print;
  100.        ClrScr;
  101.        Menu;
  102.      end;    { of List It Procedure }
  103.  
  104. Procedure Action;
  105. begin     Case Option OF      {  the following codes are for an Epson MX80 }
  106.             '1' : writeln (Lst, Char(15)); { 132 characters per line.       }
  107.             '2' : writeln (Lst, Char(18)); {  80 characters per line.       }
  108.             '3' : writeln(Lst,char(27),char(71));   { Double Strike ON      }
  109.             '4' : writeln(Lst,char(27),char(72));   { Double Strike OFF     }
  110.             '5' : Print_Msg;
  111.             '6' : List_It;
  112.      end { of Case }; end { of Action Procedure };
  113.  
  114. begin            {   Main of Program Starts here.   }
  115.    Menu;
  116.    Repeat
  117.       GotoXY (35,16);
  118.       readln(Option);
  119.       Action;
  120.       GotoXY (35,16);
  121.       write (' '); { Blank out the last selection number }
  122.    Until Option = '7';
  123.    ClrScr;
  124. end       {  of Program.   BYE!  }.
  125.  
  126.